perm filename ETEST[E,ALS] blob
sn#141918 filedate 1975-01-28 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00005 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 This is a dummy file made by extracting pages 173:175 from E
C00003 00003 SREAD, SREAD1, SREAD2, SREAD3, SREAD4, SRSTOR, SRSTR2
C00010 00004 SRACT, SREAD5, SRALT, SRALT2, SRALUZ, SREDT
C00019 00005 FINDIT, FOUND, FNDMOV, FNDERR
C00022 ENDMK
C⊗;
This is a dummy file made by extracting pages 173:175 from E
;SREAD, SREAD1, SREAD2, SREAD3, SREAD4, SRSTOR, SRSTR2
;Called by FINDIT (page 175) and FIND (page 176) to read string from TTY
;String is assembled in BUF and must be shorter than 199 characters
SREAD: MOVEI T,
MOVEM E,SAVEE# ;Save this for substitutiion case
CAIN B,3
TRO T,SDELIM
JUMPGE A,.+2
TRO T,SBKWDS
TRZE F,EDITM
TRO T,EDITM
MOVEM T,SRFLG#
MOVMM A,SRCNT#
SETZM SUBFLG# ;To be ready to read searched-for string
MOVE D,[440700,,BUF]
QREAD: MOVNI B,SRSIZ*5-1
TLZ F,TF1
PUSHJ P,TYI
JRST SREAD4 ;Find out the cause of activation
SKIPE SUBFLG ;If we are now reading the substitution string
JRST SREAD1
SETZM SUBARM ;To force a new substitution string
SETZM SUBCNT# ;0 means that a new substitution string is required
SREAD1: IDPB C,D
SREAD2: PUSHJ P,TYI
JRST SRACT ;Now act on extended string
SREAD3: AOJN B,SREAD1
SORRY SEARCH STRING TOO LONG.
SETZB D,SRCNT
AOS -1(P)
JRST SREAD2
;SREAD4 is called if an activation character is recieved before any characters.
;and it allows for ALT interruption. On a LF it returns to
;SREAD2 (with TF1 set in F) to allow for reading of additional TTY input.
;A "\" with bucky bits causes a transfer to QREAD6 which then requires that the
;old substitution string be used.
SREAD4: CAIN C,175
JRST POPTJ
LDB TT,[POINT 7,C,35]
CAIN TT,"\"
JRST QREAD4 ;No new search string for a substitute command
SKIPE SUBFLG ;May be a normal search only
JRST QREAD6 ;Woops! no substitution string
CAIE C,12
JRST SREAD5
TLO F,TF1
SOJA B,SREAD2
;This code is entered from SREAD4 when a \ is the first character showing that
;no new search string is to be typed. This is acceptable only if SUBARM is still
;set from a previous substitution and if it is not a second \
QREAD4: SKIPE SUBARM
SKIPE SUBFLG
JRST QREAD7 ;To force a redefining of substitution string
LDB B,[70200,,C]
ANDI C,177
HRL C,B
MOVEM C,QCHR#
SUBI B,2 ;So -1 for <CONTROL>, 0 for <META> and 1 for both
MOVEM B,SUBFLG ;Redefine in case of a change in bucky bits
JRST SREAD6 ;Now go as a repeat substitution
;QREAD5 is called in SRACT if a \ first string termination is received and
;it saves the \ command in 0CHR, the character "\" in the right ralf and the
;control bits in the left half. SUBFLG is also set to -1 on a CONTROL, to
;0 on a META and to +1 on both CONTROL and META.
QREAD5:
CAMN E,SAVEEE
JRST SREAD5 ;Ignore extra \
CAMN E,[FNDBUF]
MOVEI E,SUBBUF
CAMN E,[FNDTBF]
MOVEI E,SUBTBF
MOVEM E,SAVEEE# ;Set for substitution buffer
MOVE D,[440700,,BUF2]
MOVEM D,QDSP#
MOVEM A,QARG#
LDB B,[70200,,C]
ANDI C,177
HRL C,B
MOVEM C,QCHR#
SUBI B,2 ;So -1 for <CONTROL>, 0 for <META> and 1 for both
MOVEM B,SUBFLG
JRST QREAD
;QREAD6 is entered when a new searched-for string has been typed but a null
;substitution string is encountered. Verification is then requested.
QREAD6: OUTSTR [ASCIZ /
**** Do you really want a null substitution? (Type Y or N)
This IS a very dangerous thing to do, so be sure. /]
PUSHJ P,YESCHK
JRST QREAD8
OUTSTR [ASCIZ /
Type corrected substitution string and proceed, or type <ALT> to abort. /]
JRST QREAD
JRST POPTJ ;Abort
QREAD7: SETZM SUBFLG
SETZM SUBCNT
SETZM QCHR
OUTSTR [ASCIZ /No proper substitution string.
Substitution aborted. You must now retype entire command.
/]
JRST POPTJ
QREAD8: JSP Q,QRSTR3
JRST SREAD6
;SRSTOR stores the searched-for string away and gets QSTOR to do the same for
;the substitution string.
SRSTOR: SKIPE SUBFLG ;Is this the searched-for string
JRST QSTOR ;No it is the substitution string
JUMPLE D,SRSTR2
MOVEI TT,
IDPB TT,D
TLNE D,760000
JRST .-2
MOVSI TT,BUF
HRRI TT,SRCBUF(E)
SUBI D,BUF
ADDI D,(TT)
BLT TT,(D)
ADDI B,SRSIZ*5-1+1
MOVEM B,SRCSIZ(E)
SRSTR2: JUMPN D,.+2
MOVEI E,SRDUMY
SETZM SRCFLG(E)
SETOM SUBARM#
JRST (Q)
QSTOR:
JUMPLE D,QRSTR2
MOVEI TT,
IDPB TT,D
TLNE D,760000
JRST .-2
MOVSI TT,BUF2
HRRI TT,SRCBUF(E)
SUBI D,BUF2
ADDI D,(TT)
BLT TT,(D)
ADDI B,SRSIZ*5-1+1
MOVEM B,SRCSIZ(E)
QRSTR2:
JUMPN D,QRSTR3
OUTSTR [ASCIZ /
**** Do you really want a null substitution? (Type Y or N) /]
PUSHJ P,YESCHK
SKIPA
JRST POPTJ ;Abort
QRSTR3: SETZM SRCFLG(E)
MOVEI E,1
MOVEM E,SUBARM
MOVE E,SAVEE ;Restore correct value for the search
JRST (Q)
;SRACT, SREAD5, SRALT, SRALT2, SRALUZ, SREDT
SRACT: TLNE F,TF1
JRST SRALT
JSP Q,SRSTOR
SREAD5: LDB TT,[POINT 7,C,35]
CAIN TT,"\"
JRST QREAD5
SREAD6: TRZ F,ARG!REL!NEG
MOVEI DSP,CMDSP
MOVEI A,
SKIPN SUBFLG
SETZM SUBARM ;Disanm the substitution capabilities
SKIPE SUBFLG
MOVEI C,215 ;Fudge a <CONTROL><CR> in this case
PUSH P,E
PUSHJ P,CMDEX
JRST [SUB P,[2,,2]↔JRST POPJ2]
POP P,E
MOVE T,SRFLG
MOVEM D,SDSP#
MOVEM A,SARG#
HRLI C,(B)
MOVEM C,SCHR#
TLNE D,SACMD
JRST .+3
TLNE D,SSCMD
XCT -1(D)
MOVEM T,SRFLG
TRNN T,EDITM
POPJ P,
MOVE A,ARRLIN
HRRZ T,2(A)
MOVEM T,SRCNUM
MOVE T,EDCNM
MOVEM T,SRCOFF
POPJ P,
SRALT: CAIN C,15
JRST SREAD3
CAIN C,175
JRST POPTJ
CAIE C,12
JRST SRALUZ
JSP Q,SRSTOR
SRALT2: PUSHJ P,TYI
JRST SREAD5
JRST SRALT2
SRALUZ: MOVEM C,COMCHR
JRST POPTJ
BSLAS2: OUTSTR [ASCIZ /
You have replaced \/]
MOVE E,SAVEE
MOVEI A,SRCBUF(E)
HRL A,[440700]
ILDB TT,A
JUMPE TT,.+3
OUTCHR TT
JRST .-3
OUTSTR [ASCIZ /\ with \/]
MOVE E,SAVEEE
MOVEI A,SRCBUF(E)
HRL A,[440700]
ILDB TT,A
JUMPE TT,.+3
OUTCHR TT
JRST .-3
OUTSTR [ASCIZ /\
You are in the line editor, type <ALT> to abort, continue to edit, or exit as usual.
/]
POPJ P,
;TEST FOR TYPE OF TERMINATION OF SEARCH COMMAND WHEN <META>\ GIVEN
MOVEI TT,377 ;Back up one character
MOVE C,SCHR
CAIN C,215
MOVEM TT,215
CAIE C,760
CAIN C,720
MOVEM TT,215
MOVEI T,0
MOVEI TT,215 ;To undo the <CONTROL><CR> induced earlier
PTWR1W T
POPJ P,
;This code responds to the \ command.
;<CONTROL>\ accepts the last substitution (if still unconfirmed) and goes
;on to show the next one.
;<META>\ not a proper command in this context. It introduces a \ in the text.
;<META><CONTROL>\ accepts the last unconfirmed substitution and proceeds to make
;substitutions thereafter to the end of the page or of the document as requested.
BSLAS: HRL C,B
MOVEM C,QCHR ;Set arming word
; MOVEI T,0
SETOM SUBFLG
BSLAS0: XCT BSLAS0(B)
JRST BSLCON ;<CONTROL>\ routine
JRST BSLMET ;<META>\ routine
MOVEI TT,1
MOVEM TT,SUBCNT ;Set to repeat
JRST SREAD5
BSLCON: SETZM SUBCNT ;Set for one substitution only
JRST SREAD5
MOVEI TT,15 ;Give a <CR> in case we are in line editor
JRST BSLGO ;and go
BSLMET: SETOM SUBFLG ;Set to execute next one after
MOVEI TT,215 ;getting out of line editor with an ALT
PTWR1W T ;to abort unconfirmed substitution
MOVEI TT,15 ;and space to next line to avoid retrying
BSLGO: PTWR1W T
MOVE E,SAVEE
CAIE E,FNDBUF ;Test for type of FIND
JRST FNDBSL ;Single page
JRST FINBSL ;Multi-page
;This is the code that actually does the substitution. It is called in EDGL if
;SUBFLG is not zero. However since it is a potentially dangerous bit of code and
;could wipe out an entire file, it must also be armed by having the right half of
;QCHR contain 134 ("\"). If the left half of QCHR is 3 and if SUBFLG is positive
;this routine leaves QCHR armed and adds 1 to SUBCNT.
BSLXCT: HRRZ A,QCHR
CAIN A,"\"
JRST BSLXC2
OUTSTR [ASCIZ /
WOOPS! the system goofed! but it is all right, ETV was on the job.
/]
SETZM QCHR ;Disarm
SETZM SUBFLG ;set stop
POPJ P, ;and forget it.
BSLXC2: MOVE E,SAVEE
MOVE A,SRCSIZ(E) ;Get the size of the searched-for string
MOVEI T,0
MOVEI TT,304 ;A <CONTROL>D character
PTWR1W T ;Send this to the PTY
SOJG A,.-1 ;Do this A times
MOVE E,SAVEEE
MOVEI A,SRCBUF(E) ;Pointer starting address
HRL A,[440700]
ILDB TT,A ;Get a substitution character
JUMPE TT,.+4
TRO TT,400 ;Set the META bit
PTWR1W T ;Send this chatacter
JRST .-4
HLRZ A,QCHR
CAIN A,3 ;Was this set to 3?
AOSG SUBFLG ;yes, but is SUBFLG ≠ -1?
JRST BSLXC3 ;No, so better stop
;The following code reinitiallizes the find and substitute command by the
;simple technique of resending to the TTY the necessary string. It should be
;faster and better to store the necessary information directly but I have
;not been able to figure out how to do this correctly.
AOS SUBCNT ;To count repeats
MOVEI TT,15 ;A temporary expedient since there is an error in
PTWR1W T ;the old FIND portion that causes trouble
MOVE TT,SUBRPT# ;This was saved in FIND or in EXTEND
PTWR1W T
ANDI TT,177 ;Get letter only
CAIE TT,"F"
CAIN TT,"f"
JRST BSLXC4
CAIE TT,"X"
CAIN TT,"x"
SKIPA
JRST BSLXC5 ;Something is wrong so stop.
MOVEI TT,"F" ;Now send rest of the X string command
PTWR1W T
MOVEI TT,"I"
PTWR1W T
MOVEI TT," "
PTWR1W T
BSLXC4: MOVEI TT,734 ;A final <META><CONTROL>\ and we are off
PTWR1W T
POPJ P, ;This may not be needed
MOVEI A,BSLGO ;We want EDGL on completion to POPJ here
HLL A,(P) ;Get usual left side
EXCH A,(P)
PUSH P,A
MOVEI T,0
MOVEI TT,215
POPJ P,
BSLXC3: PUSHJ P,BSLAS2 ;To type message and return
POPJ P,
BSLXC5: PUSHJ P,BSLAS1 ;Type disarming message
SETZM QCHR ;Disarm
SETZM SUBFLG ;and STOP it!
SETZM SUBCNT ;and STOP it!
POPJ P,
MOVEI TT,15 ;We need a carriage return
PTWR1W T ;So send it
AOS (P)
POPJ P,
BSLAS1: OUTSTR [ASCIZ /
Something went wrong with the repeat command so retype from start.
/]
POPJ P,
;FINDIT, FOUND, FNDMOV, FNDERR
;FINDIT is called by the F command (single page search)
FINDIT: SETZM TYIPNT
MOVE T,B ;Reconstruct the initial activator
LSH T,7
ADD T,C
MOVEM T,SUBRPT ;Save for possible use in repeat command
MOVEI E,FNDTBF
PUSHJ P,SREAD ;To read string in from TTY (on page 173)
FNDBSL: PUSHJ P,SCOMP
PUSHJ P,SRCPAG
JRST FNDERR
FOUND:
SETZM ESCIEN
PUSHJ P,SPFIN
PUSHJ P,SFLUSH
FND2: HLRZ B,SCHR
HRRZ C,SCHR
MOVE A,SARG
MOVE D,SDSP
TRNE F,ARG
TRNE F,REL
TLNN D,SACMD
JRST FNDMOV
TRON F,ARG!REL
MOVEI A,
TLNE D,SSCMD
XCT -1(D)
SUB A,ARRL
ADD A,SRCL
JRST POPJ2
FNDMOV:
JUMPGE D,.+2
TRNN F,REL
SKIPA A,SRCL
ADD A,SRCL
PUSHJ P,SETARR
MOVE A,SARG
; TLNE D,SSCMD
; XCT -1(D)
MOVE T,SRCOFF
TLNE D,EDOK*10
MOVEM T,EDMOV
JRST POPJ2
FNDERR: SKIPE ESCIEN ;DIRECT IF ESC I GOT US HERE
JRST FNDER3
SKIPLE SUBCNT
JRST SUBERR
MOVE T,SRCN1
CAME T,SRCNT
SKIPA T,[[ASCIZ /NOT FOUND ENOUGH -- /]]
MOVEI T,[ASCIZ /NOT FOUND -- /]
FNDER2: OUTSTR [ASCIZ /
SORRY -- /]
OUTSTR (T)
CAIA
FNDER3: OUTSTR [ASCIZ / while searching for /]
SETZM ESCIEN
SETZM SUBFLG
SETZM SUBCNT
MOVE B,SDATA
ADDI B,SRCBUF
PUSHJ P,SFLUSH
SETZM COMCHR
JRST CMDER2
;This message appears at end of a repeating substitution execution.
SUBERR: OUTSTR [ASCIZ / After /]
SETZM TYOPNT
TYPDEC SUBCNT
OUTSTR [ASCIZ / substitutions/]
SETZM SUBCNT
JRST FNDER3
;PAGE 4